
// 全局通用工具
export default{
	// 空白显示
	blankDisplay(value) {
		return value || "xxx";
	},
	// 拆分数组每个数组多少个
	arrayChunk(array, size) {
		let data = []
		for (let i = 0; i < array.length; i += size) {
			data.push(array.slice(i, i + size))
		}
		return data;
	},
	remove(arr, val) {
		const index = arr.indexOf(val);
		if (index > -1) {
			arr.splice(index, 1);
		}
	},
	routerPush(_this, params = {}) {
		let routeData = _this.$router.resolve(params);
		window.open(routeData.href, "_blank");
	},
	openUrl(path) {
		window.open(path, "_blank");
	},
	isMobile(userAgent, isNotWindow) {
		var userAgentInfo = userAgent || navigator&&navigator.userAgent || "";
	 
		var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
	 
		var mobile_flag = false;
		
		  //根据userAgent判断是否是手机
		for (var v = 0; v < mobileAgents.length; v++) {
			if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
					mobile_flag = true;
					break;
			}
		}

		if(isNotWindow){
			return mobile_flag;
		}

		var screen_width = window.screen.width;
		var screen_height = window.screen.height;
	
		//根据屏幕分辨率判断是否是手机
		if (screen_width > 325 && screen_height < 750) {
			mobile_flag = true;
		}
	 
		return mobile_flag;
	 }
}